import * as Pinia from 'pinia';

// import {loadModules, mountToApp} from "@/infrastructure/utils/common"

export function setupStore(app) {
  app.use(Pinia.createPinia())
  loadStore(app)
  return Pinia
}



function loadStore(app){
	let $store = loadModules(import.meta.globEager("./modules/*.js"), (targer, key, value) => {
		targer[key] = value;
		targer[key+"Store"] = value()
	})
	mountToApp(app, '$store', $store)
	uni.$store = $store
}